<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use common\models\category\Category;

/* @var $this yii\web\View */
/* @var $model common\models\category\Category */
/* @var $form yii\widgets\ActiveForm */
?>

<?php $parentCatalog = ArrayHelper::merge([0 =>'顶级分类'], ArrayHelper::map(Category::get(0, Category::find()->all()), 'id', 'str_label'));
unset($parentCatalog[$model->id]); ?>

<div class="category-form">

    <?php $form = ActiveForm::begin(); ?>
	
    <?= $form->field($model, 'parent_id')->dropDownList($parentCatalog) ?>

    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'status')->dropDownList(array('1'=>'显示','0'=>'不显示')) ?>

    <?= $form->field($model, 'type')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'ctype')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'sort')->textInput() ?>

    <?= $form->field($model, 'seo_keywords')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'seo_contents')->textarea(['rows' => 6]) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
